package 图.有向图;

import 抽象数据类型.Digraph;

/**
 * @description:
 * @author: ywk
 * @date: 2021-08-05
 */
public class 顶点对的可达性 {
    public class TransitiveClosure{
        private 有向图的可达性.DirectedDFS[] all;
        TransitiveClosure(Digraph g){
            all = new 有向图的可达性.DirectedDFS[g.V()];
            for (int v = 0; v < g.V(); v++) {
                all[v] = new 有向图的可达性.DirectedDFS(g, v);
            }
        }
        boolean reachable(int v, int w) {
            return all[v].marked(w);
        }
    }


}
